import apiClient from '@/lib/interceptor';

// 获取个人待办事项
export interface TodoItem {
  id: number;
  matterContent: string;
  employeeId: string;
  startTime: string;
  endTime: string;
  status: number;
  creatorId?: string; // 创建者的员工ID
}

// 创建待办事项请求参数
export interface CreateTodoParams {
  employeeId: string;
  matterContent: string;
  startTime: string;
  endTime: string;
}

// 更新待办事项请求参数
export interface UpdateTodoParams {
  id: number;
  matterContent: string;
  startTime: string;
  endTime: string;
}

// 获取个人待办事项列表
export const fetchTodoList = async () => {
  return await apiClient.get('/todoList');
};

// 完成待办事项
export const updateTodoStatus = async (id: number) => {
  return await apiClient.patch(`/todoList/finish/${id}`);
};

// 更新待办事项内容
export const updateTodoItem = async (params: UpdateTodoParams) => {
  return await apiClient.patch('/todoList', params);
};

// 创建个人待办事项
export const createTodoItem = async (params: CreateTodoParams) => {
  return await apiClient.post('/todoList', params);
};
